#ifdef __cplusplus
extern "C"{
#endif

int __xs_writev__ ( int  __f, const struct iovec *__iov, int __cnt);
int __xs_readv__( int __f, struct iovec *__iov, int __cnt);
int __xs_read_n__ (int __f, void *__p, int __nbytes);
int __xs_write_n__(int __f, void *__p, int __nbytes);
int __xs_set_non_blocking__( int __f );
int __xs_close_fd__(int __f);



/* Set the file descriptor to use non-blocking I/O.  Returns 0 for success,
   -1 on error. */
#define set_nonblocking( __fd )	__xs_set_non_blocking__( __fd )
#define xs_release_socket(__fd)	__xs_close_fd__(__fd)
//#define xs_close_socket(_fd) 		do{xs_logd("close socket");xs_release_socket(_fd);}while(0)


/* Does the I/O error indicate that the operation should be retried later? */
#define ERRNO_IO_RETRY(EN) \
    (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR))
    

#ifdef __cpluscplus
}
#endif

